#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>

int my_strcmp(char* str_1, char* str_2)
{
	char* cmp_1 = str_1;
	char* cmp_2 = str_2;
	if(!cmp_1 || !cmp_2) {	
		printf("Error occured : cannot compare null string!\n");
		exit(0);
	}

	while(*cmp_1 && *cmp_2) {
		if(*cmp_1 > *cmp_2) {	
			return 1;
		}
		if(*cmp_1 < *cmp_2) {
			return -1;
		}
		cmp_1++, cmp_2++;
	}
	if(*cmp_1 == '\0' || *cmp_2 == '\0') {
		if(*cmp_1 == '\0' && *cmp_2 != '\0') {
			return -1;
		}
		else if(*cmp_1 != '\0' && *cmp_2 == '\0') {
			return 1;
		}
		else {
			return 0;
		}
	}
	return 0;
}

int main()
{
	char* str_1 = "baaaaaaaaaaaa\n";
	char* str_2 = NULL;//"caaaaaaaaaaaa\n";

	int res = my_strcmp(str_1, str_2);
	printf("%d\n", res);

	return 0;
}
